<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="info.niwota.gae.cache.BlobObject" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 
  "http://www.w3.org/TR/html4/strict.dtd">
<%
  BlobObject item = (BlobObject) request.getAttribute("item");
  User user = (User) request.getAttribute("user");
  String rotation = (String) request.getAttribute("rotation");
  String key = (String) request.getAttribute("key");
%>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Viewer</title>
</head>
<body>
  <div align="right">
   
  <h1 align="center">
    <%= item.getUri() %>
  </h1>
  <form action="" method="get" accept-charset="utf-8">
    Rotation
    <select name="rotate" onchange="javascript:form.submit()" size="1">
      <option <% if ("0".equals(rotation)) { %>selected<% } %> value="">0&deg;</option>
      <option <% if ("90".equals(rotation)) { %>selected<% } %> value="90">90&deg;</option>
      <option <% if ("180".equals(rotation)) { %>selected<% } %> value="180">180&deg;</option>
      <option <% if ("270".equals(rotation)) { %>selected<% } %> value="270">270&deg;</option>
    </select>
    <input type="hidden" name="key" value="<%= key %>">
    <input type="submit" value="View">
  </form>
  <hr />
  <iframe width="100%" height="500" src="/cache/download?key=<%= key %>&rotate=<%= rotation %>"></iframe>
  <a href="/cache/list">Back</a>
</body>
</html>